﻿#pragma once

#include <log4lite/t_string.h>

namespace log4lite {

    typedef int LogCatagory;


    const LogCatagory OFF_LOG_CATAGORY	= 0x10000000;

    const LogCatagory FATAL_LOG_CATAGORY   = 0x00000001;
    const LogCatagory ERROR_LOG_CATAGORY   = 0x00000002;
    const LogCatagory WARN_LOG_CATAGORY    = 0x00000004;
    const LogCatagory INFO_LOG_CATAGORY    = 0x00000008;
    const LogCatagory DEBUG_LOG_CATAGORY   = 0x00000010;
    const LogCatagory TRACE_LOG_CATAGORY   = 0x00000020;

    const LogCatagory ALL_LOG_CATAGORY     = FATAL_LOG_CATAGORY|ERROR_LOG_CATAGORY|WARN_LOG_CATAGORY|INFO_LOG_CATAGORY|DEBUG_LOG_CATAGORY|TRACE_LOG_CATAGORY;

#define _TRACE_STRING	T_TEXT("TRACE")
#define _DEBUG_STRING	T_TEXT("DEBUG")
#define _INFO_STRING	T_TEXT("INFO")
#define _WARN_STRING	T_TEXT("WARN")
#define _ERROR_STRING	T_TEXT("ERROR")
#define _FATAL_STRING	T_TEXT("FATAL")

#define _OFF_STRING		T_TEXT("OFF")

#define _NOTSET_STRING	T_TEXT("NOTSET")
#define _UNKNOWN_STRING T_TEXT("UNKNOWN")



	class LogCatagoryManager 
	{
	public:
		tstring toString(LogCatagory lc)
		{
			switch(lc) {
				case OFF_LOG_CATAGORY:     return _OFF_STRING;
				case FATAL_LOG_CATAGORY:   return _FATAL_STRING;
				case ERROR_LOG_CATAGORY:   return _ERROR_STRING;
				case WARN_LOG_CATAGORY:    return _WARN_STRING;
				case INFO_LOG_CATAGORY:    return _INFO_STRING;
				case DEBUG_LOG_CATAGORY:   return _DEBUG_STRING;
				case TRACE_LOG_CATAGORY:   return _TRACE_STRING;
			};
			return _UNKNOWN_STRING;
		}
	};
}